package structs.book;

import java.util.ArrayList;
import java.util.Collections;

public class Editions extends ArrayList<Edition> {

	public Editions() {
		super(5);
	}
	
	@Override
	public boolean add(Edition e) {
		if (!super.contains(e)) {
			super.add(e);
			Collections.sort(this);
			return true;
		}
		else
			return false;
	}
	
	public boolean add(String e, double p) {
		return add(new Edition(e,p));
	}
	
	public boolean add(String e) {
		return add(e,0.0);
	}
	
	public Edition getMostRecent() {
		return get(0);
	}
	
}
